package cn.sylinx.horm.example.section8;

import java.util.HashMap;
import java.util.List;

import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;

import cn.sylinx.horm.core.SqlClient;
import cn.sylinx.horm.example.section7.MyExample7;
import cn.sylinx.horm.resource.ClasspathSqlResource;

@Profile("section8")
@Component
public class Section8 implements CommandLineRunner {

    private SqlClient sqlClient;

    public Section8(SqlClient sqlClient) {
        this.sqlClient = sqlClient;
    }

    @Override
    public void run(String... args) throws Exception {
        testSqlClientInterceptor1();
    }

    void testSqlClientInterceptor1() {

        List<MyExample7> dataList = sqlClient.queryList(
                ClasspathSqlResource.applySystemResource("horm/system/testExample7.sql"), new HashMap<>(), MyExample7.class);
        System.out.println(dataList);
        System.out.println("-----------");
        System.out.println();
    }
}
